package org.hongqi.common.senpec.sys.operate;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import jakarta.persistence.Entity;
import lombok.*;
import org.hongqi.common.senpec.base.mybatisplus.IBaseEntity;

import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Entity(name = "senpec_sys_operate")
@TableName("senpec_sys_operate")
public class Operate extends IBaseEntity<Operate> {
    private String username;
    private String requestUri;//获取请求的资源路径
    private String scheme;//返回用以作出请求消息的方案的名称，如 http, https, 或ftp等
    private Integer serverPort;//请求的服务器端口
    private String serverName;//请求的服务器主机名
    private String remoteHost;//客户端的主机名
    private String remoteAddr;//客户端的ip
    private String method;//请求的方法

    @TableField(fill = FieldFill.INSERT)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
